package hd.cls6;

import java.util.*;

/**
 * @author oldliu
 * @since 1.0
 */
public class IterAtolrTest {
    public static void main(String[] args) {
        List<Integer> numbers = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
        System.out.println("原始 List: " + numbers);
        Iterator<Integer> iterator = numbers.iterator();
        while (iterator.hasNext()) {
            Integer number = iterator.next();
            if (number % 2 == 0) {
                iterator.remove();
            }
        }
        System.out.println("删除偶数后的 List: " + numbers);
    }
}
